/**
 * Copyright 2015-2016 eyaomall.cn
 * All rights reserved.
 *
 * @project
 * @author jackey
 * @version 1.0
 * @date 2016-01-06
 */
package com.eyaomall.wxmall.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.eyaomall.wxmall.model.po.Article;
import com.eyaomall.wxmall.service.ArticleService;
import com.lycheeframework.core.cmp.api.http.GsnData;
import com.lycheeframework.core.cmp.api.http.GsnResponse;
import com.lycheeframework.core.cmp.kit.PageHTTPObject;

/**
 * 文章库
 * @author jipengfei
 *
 */
@Controller
@RequestMapping("article")
public class ArticleController {
	
	@Autowired
	private ArticleService articleService;
	
	/**
	 * 阅读首页
	 */
	@RequestMapping("index")
	public String index(){
		return "article/page_content";
	}
	
	/**
	 * 分页查询数据
	 */
	@RequestMapping("page_data")
	public @ResponseBody GsnData pageData(Article article,PageHTTPObject object){
		return GsnResponse.toData(articleService.pageDate(article,object));
	}
	
	/**
	 * 更新阅读数
	 */
	@RequestMapping("num")
	public @ResponseBody int readingNum(Integer id){
		return articleService.updateNum(id);
	}
}
